
<?php

class Notificaciones extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('tardia_model', '', TRUE);
    }

    function index() {
        
    }

    function justificar_index() {
        $this->load->library('form_validation');
        $marca['marca1'] = $this->input->post('marca');
        //$marca['marca'] = $this->uri->segment(3);
        $tipo_usuario = $this->session->userdata('tipo');
        $this->load->view('templates/head');
        if ($tipo_usuario == 1) {
            $this->load->view('templates/header');
        } else if ($tipo_usuario == 2) {
            $this->load->view('templates/header_jefe');
        } else {
            $this->load->view('templates/header_usuario');
        }
        $this->load->view('notificaciones_justificar_view', $marca);
        $this->load->view('templates/footer');
        //redirect('notificaciones/justificar_form/'.$this->uri->segment(3) ,'refresh');
    }

    function justificar_form() {
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->form_validation->set_rules('justificacion', 'justificacion', 'required');
        // $marca = $this->input->post('marca');
        $marca['marca1'] = $this->input->post('marca1');
        $marcas = $this->input->post('marca1');


        if ($this->form_validation->run() === FALSE) {
            $this->load->view('templates/head');
            $this->load->view('notificaciones_justificar_view', $marca);
        } else {
            $justificacion = $this->input->post('justificacion');
            $this->tardia_model->actualizarJustificacion($marcas, $justificacion);
            $this->tardia_model->actualizarEstado($marcas, 2);
            redirect('paginacion/notificaciones', 'refresh');
            //$marca 
            //echo $justificacion;
            //echo $marcas;
            //redirect('home','refresh');
        }
    }

}

?>